var baseUrl = "http://wash.runlaiwangluo.com"
baseUrl = "http://localhost";
baseUrl = "http://charg.runvp.com";
var token = sessionStorage.getItem("token");
if(null != token){
	token = "Bearer "+token;
}
var reqJsonPost = {
	//二次封装jquery中的ajax请求
	ajax : function(url,data,fn){
		$.ajax({
			url: baseUrl+url, //地址
			type: "Post",
			dataType: "json",
			contentType: "application/json",
			data: JSON.stringify(data),
			success: function(data) {
				// console.log("post",data)
				console.log("post result:{}",data)
				check(data);
				fn(data)
			},
			error: function(data) {
				// console.log("post",data)
				fn(data);
			}
		});
	}
}
function getUrlParam(url, paramName) {
  const searchParams = new URLSearchParams(new URL(url).search);
  return searchParams.get(paramName);
}
var reqGet = {
	//二次封装jquery中的ajax请求
	ajax : function(url,fn){
		var sn = getUrlParam(baseUrl+url,"sn");
		$.ajax({
			url: baseUrl+"/app/client/deb/getCode?sn="+sn, //地址
			type: "get",
			success: function(data) {
				console.log("get",data)
				if(data.code == 0){
					$.ajax({
						url: baseUrl+"/server"+url+"&outCode="+data.data, //地址
						type: "get",
						success: function(data) {
							// console.log("get",data)
							console.log("get result:{}",data)
							check(data);
							fn(data)
						},
						error: function(data) {
							fn(data);
						}
					});
				}else{
					alert(data.msg)
					return;
				}
			},
			error: function(data) {
				fn(data);
			}
		});

	}
}
function check(result){
	if(0 != result.code){
		fail_prompt(result.msg,500);
		return;
	}
}
function success(result,message){
	if(result.code == 0){
		success_prompt(message,500);
	}
}